FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/node:22-alpine AS build-stage
# 设置作者
LABEL author=zhangming
# 设置工作目录
WORKDIR /app
# 复制package.json
COPY mall-ui/package*.json ./
# 安装依赖
RUN npm ci
# 复制源代码
COPY mall-ui/. .
# 构建项目
RUN npm run build-only


FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/nginx:alpine
COPY --from=build-stage /app/dist /usr/share/nginx/html
COPY mall-ui/nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]